import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';

@Entity()
export class Visitor {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  ip: string;

  @Column()
  location: string;

  @Column()
  device: string;

  @Column()
  source: string;

  @Column({ type: 'int', default: 0 })
  duration: number; // 停留时间（秒）

  @Column({ type: 'timestamp' })
  visitTime: Date;

  @Column({ type: 'timestamp', nullable: true })
  leaveTime: Date;

  @CreateDateColumn()
  createdAt: Date;
} 